Microsoft Excel is a convenient tool for collecting model information. Any ActiveX
compatible application, such as Excel, can be used as a destination or source of
model information. ActiveX application documents, such as Excel workbooks, can be
embedded in a model document or they can be separate application documents. Embedding ActiveX objects in an apiMAX model is done by creating an Ole Item. The
Ole Item is the container for the ActiveX object.
Follow the instructions below to extend the two-stage flash model created in
Building Models to send data to an embedded Excel spreadsheet.
Learn the basics for adding embedded ActiveX objects, naming items, adding item
code, communicating with an ActiveX object and adding multiple sequencers.
Add an Embedded Excel Spreadsheet
- Select from menu Edit | Insert New Object
- Select the option Create New. Select Microsoft Excel Worksheet
as the Object Type.
- Press OK.
-
apiMAX inserts a new Excel workbook in your model and switches to Excel.
Note. Menus
and toolbars displayed are from Excel application.
- Click an empty area of the model to close the workbook.
- Clicking an embedded object
selects the item. Double-clicking
an embedded object opens the object's server application.
-
Activate the Excel workbook by pointing to the workbook, press and hold the Ctrl
key and click the left mouse button.
- Resize the workbook using the small sizing
handles on the workbook's frame and edit the cells in Sheet1 to reflect the following.
Click an empty area of the model to close the embedded workbook.
Name the Items
-
You need to reference items. There are a number of ways
to reference items. The easiest way is to name the items.
- Name the Excel workbook item Results by right clicking on the workbook.
- Click Properties... and enter Results as the Ole Item Name.
- Press OK.
-
Name each item that you want to reference from VBA.
- The convention used in this
example is to name the liquid streams L1, L2 and L3 and the steam streams S1 and
S2.
- Streams are named by double-clicking the stream. Select the General
tab, enter
the Name and press OK.
- The stream names shown in blue below are text items added
separately.
Create Item Code
-
Add item code for the embedded Excel workbook by right clicking on the workbook.
- Select Item Code | Create.